package com.gitee.wsl.compose.chart.xy.line.area

import androidx.compose.animation.core.AnimationSpec
import androidx.compose.runtime.Composable
import com.gitee.wsl.common.ui.draw.style.AreaStyle
import com.gitee.wsl.common.ui.draw.style.LineStyle
import com.gitee.wsl.compose.chart.KoalaPlotTheme
import com.gitee.wsl.compose.chart.SelectCheck
import com.gitee.wsl.compose.chart.xy.SymbolSlate
import com.gitee.wsl.compose.chart.xy.line.LinePlot
import com.gitee.wsl.compose.chart.xy.line.LinePlotSlate
import com.gitee.wsl.compose.chart.xy.line.area.model.AreaBaseline
import com.gitee.wsl.compose.chart.xy.model.PointEntry


fun <X, Y> LinePlot.Area(
    areaBaseline:(Int)-> AreaBaseline<X, Y>,
    areaStyle: (Int)-> AreaStyle,
    lineStyle: ((Int)-> LineStyle?)? = null,
    symbol: SymbolSlate<PointEntry<X, Y>>? = null,
    animationSpec: @Composable (Int)-> AnimationSpec<Float> = { KoalaPlotTheme.animationSpec },
    selected :SelectCheck = { false }
):LinePlotSlate<X, Y> = { index, data ->
    AreaPlot(
        data = data,
        areaBaseline = areaBaseline(index),
        areaStyle = areaStyle(index),
        lineStyle = lineStyle?.invoke(index),
        symbol = symbol,
        animationSpec = animationSpec(index),
        selected = selected.invoke(index)
    )
}
